package dujiu.luogu.array;

import java.util.Scanner;

public class P1428 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 1; j <= i; j++) {
                if (arr[i] > arr[j]){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
